//
//  SearchScenicPointCCell.m
//  louvre
//
//  Created by 王鹏宇 on 2018/6/20.
//  Copyright © 2018年 imguider. All rights reserved.
//

#import "SearchScenicPointCCell.h"

@implementation SearchScenicPointCCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    self.officialLabel.textColor = [UIColor whiteColor];
    self.nameLabel.textColor = [UIColor whiteColor];
    self.enLabel.textColor = kTitleColor;
    self.iconImageView.layer.borderWidth = 0.5f;
    self.iconImageView.layer.borderColor = kThemeColor.CGColor;
}

- (void)setSelect:(BOOL)select {
    _select = select;
    self.iconImageView.layer.borderWidth = _select ? 3 : 0;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    if (_select) {
        self.iconImageView.layer.borderWidth = _select ? 3 : 0;
    }
}
- (void)configData:(ScenicPoint *)model {
    
    NSURL * url = [NSURL URLWithString:model.pictureArray.firstObject];
     UIImage *placeHoder = [UIImage imageNamed:@"placeholder_squ"];
    
    [self.iconImageView setImageWithURL:url placeholder:placeHoder];
    
    if (model.spotname.length > 0) {
        self.nameLabel.text = model.spotname;
    }
//    if (model.ename.length > 0) {
//        self.enLabel.text = model.ename;
//    }
    
    if (model.nodenumber.length > 0) {
        self.officialLabel.text = model.nodenumber;
        
        NSMutableAttributedString * str = [[NSMutableAttributedString alloc] initWithString:[NSString localizedStringWithFormat:MYLocalizedString(@"SITEPLAY_SEARCH_ID", nil),model.nodenumber]];
        [str setColor:kThemeColor range:NSMakeRange(str.length - model.nodenumber.length, model.nodenumber.length)];
        
        self.officialLabel.attributedText = str;
    }else {
        self.officialLabel.text = [NSString stringWithFormat:MYLocalizedString(@"SITEPLAY_SEARCH_ID", nil),@"无"];
    }
}
@end
